#include <iostream>

#include "OCTTrackingImpl.h"
#include <QApplication>

int main(int argc, char **argv) {
    std::cout << "Hello, world!" << std::endl;
    /// Test OCTImageProcessing
    OCTImageProcessing* imgP = new OCTImageProcessing();
    OCTSourceSetting* oct = new OCTSourceSetting();
    Mat tmp0 = oct->readSingleDatFile(argv[1], 512, 512);
    Mat tmp2 = imgP->convertSurfaceToGrayImage(tmp0);
    
    Mat tmp1 = imgP->surfaceSubtraction(tmp0);
    Mat tmp = imgP->convertSurfaceToGrayImage(tmp1);
    namedWindow("TEMP");
    imshow("TEMP", tmp2);
    
    namedWindow("TEMP3");
    imshow("TEMP3", tmp);
//     
//     
//     tmp0 = tmp0.colRange(225,325).rowRange(392,492);
//     tmp0 = imgP->surfaceSubtraction(tmp0);
//     Mat tmp3 = imgP->convertSurfaceToGrayImage(tmp0);
//     
//     namedWindow("TEMP3");
//     imshow("TEMP3", tmp3);
    
    /// Test class OCTTrackingImpl
    //OCTSourceSetting* octSource = new OCTSourceSetting();
    //octSource->readSingleDatFile();
    //OCTTrackingImpl* impl = new OCTTrackingImpl();
    //impl->setOCTSource(argv[1], 512, 512);
    //impl->setLandmark();
    
    /// Test pattern 
//     LandmarkPattern* landmarkPattern = new LandmarkPattern();
//     landmarkPattern->createCircularPattern(200);
//     
//     OCTImageProcessing* imgP = new OCTImageProcessing();
//     
//     Mat tmp = imgP->convertSurfaceToGrayImage(landmarkPattern->getPatternMatrix());
//     namedWindow("TEMP", 1);
//     imshow("TEMP", tmp);
    
    
    /// Test OCTImageLocating
//     OCTLandmarkLocating* octImageLoc = new OCTLandmarkLocating();
//     OCTImageProcessing* imgP = new OCTImageProcessing();
//     OCTSourceSetting* oct = new OCTSourceSetting();
//     
//     Mat tmp0 = oct->readSingleDatFile(argv[1], 512, 512);
//     Mat tmp = imgP->convertSurfaceToGrayImage(tmp0);
//     
//     LandmarkPattern* landmarkPattern = new LandmarkPattern();
//     landmarkPattern->createCircularPattern(24);
//     
//     Point appCenter(417,200);
//     Landmark* landmark = new Landmark(appCenter, 50, 50, landmarkPattern);
//     
//     Point3f landPt = octImageLoc->locatingLandmark(tmp0, landmark);
//     
//     cout << landPt << endl;
//     
//     line(tmp, Point(landPt.x - 10, landPt.y), Point(landPt.x + 10, landPt.y), Scalar(255));
//     line(tmp, Point(landPt.x, landPt.y - 10), Point(landPt.x, landPt.y + 10), Scalar(255));
//     
//     namedWindow("TEMP", 1);
//     imshow("TEMP", tmp);
//     imwrite("Experiment_Image/sourceSurfaceImage.png", tmp);
    
    waitKey();
    //delete impl;
//     delete landmarkPattern;
//     delete octImageLoc;
    delete imgP;
    delete oct;
//     delete landmark;
    
    return 0;
}
